import {connect} from 'react-redux'
import { setVisibilityFilter } from '@/store/actions'
import Link from '../components/Link.jsx'

const mapStateToProps = (state, ownProps) => {
  console.log('filterlink',ownProps)
  return {
    active: ownProps.filter === state.visibilityFilter
  }
}
const mapDispatchToProps = (dispatch, ownProps) => {
  return {
    onClick: () => dispatch(setVisibilityFilter(ownProps.filter))
  }
}

const FilterLink = connect(mapStateToProps, mapDispatchToProps)(Link)

export default FilterLink